home *** CD-ROM | disk | FTP | other *** search
- /* Draw a book with shadow using OpalPaint -by Carmen Rizzolo */
- /* 11/13/92 */
-
- address 'OpalPaint_Rexx'
-
- options Results
-
- AskBool 'Do you want to draw a book?'
- If Result=0 Then EXIT
-
- SaveSetUp
-
- Okay 'Pick a colour from your palette to define cover then draw the rectangle.'
-
- GetRect
- parse var Result X1 Y1 X2 Y2
-
- /* Check if book is too small */
- Width = X2 - X1
- Heigth = Y2 - Y1
- If Width > Heigth Then Do
- A = Width - 5
- End
- Else Do
- A = Heigth - 5
- End
-
- ShadowBool = 1
- If A < 0 Then Do
- Okay 'Book too small for shadows'
- ShadowBool = 0
- End
-
- GetPen
- Parse var Result R G B
- Shadow = 0
- If ShadowBool = 1 Then Do
- AskInt 0 500 'Enter Shadow distance ( RETURN = no shadow)'
- Shadow = Result
-
- If Shadow = "" Then Shadow = 0
- SX1 = X1 + Shadow
- SY1 = Y1 + Shadow
- SX2 = X2 + Shadow
- SY2 = Y2 + Shadow
- End
-
- /* Initialize */
-
- FillMode SOLID
- SetDrawMode 1
- SmoothPaper
- ClearColGrad
- ClearTransGrad
- ColourDither 0
- TransDither 0
- Trans 0
- ActiveNozzle 1
-
- /* Draw dropshadow */
-
- If Shadow > 0 Then Do
- Done = 0
- Trans 1
- SetPen 0 0 0
- If SX1 > X2 Then Do
- SolidRect SX1 SY1 SX2 SY2
- Done = 1
- End
- If SY1 > Y2 & Done = 0 Then Do
- SolidRect SX1 SY1 SX2 SY2
- Done = 1
- End
- If Done = 0 Then Do
- SolidRect (X2 + 1) SY1 SX2 SY2
- SolidRect SX1 (Y2 + 1) X2 SY2
- End
- Trans 0
- End
-
- /* Draw Cover */
- SetPen R G B
- SolidRect X1 Y1 X2 Y2
-
- /* Draw Highlights */
-
- R1 = R
- G1 = G
- B1 = B
-
- If R1 < 255 Then Do
- A = (255 - R1) / 4
- A = Trunc(A)
- R1 = R1 + A
- End
- If G1 < 255 Then Do
- A = (255 - G1) / 4
- A = Trunc(A)
- G1 = G1 + A
- End
- If B1 < 255 Then Do
- A = (255 - B1) / 4
- A = Trunc(A)
- B1 = B1 + A
- End
-
- SetPen R1 G1 B1
- Line (X1 + 1) (Y1 + 1) (X2 - 2) (Y1 + 1)
- Line (X1 + 1) (Y1 + 1) (X1 + 1) (Y2 - 2)
-
- R2 = R1
- G2 = G1
- B2 = B1
-
- If R2 < 255 Then Do
- A = (255 - R2) / 3
- A = Trunc(A)
- R2 = R2 + A
- End
- If G2 < 255 Then Do
- A = (255 - G2) / 3
- A = Trunc(A)
- G2 = G2 + A
- End
- If B2 < 255 Then Do
- A = (255 - B2) / 3
- A = Trunc(A)
- B2 = B2 + A
- End
-
- SetPen R2 G2 B2
- Line X1 Y1 (X2 - 1) Y1
- Line X1 Y1 X1 (Y2 - 1)
- SetPen 255 255 255
- Line X1 Y1 X1 Y1
-
- /* Draw Shading */
-
- R3 = R
- G3 = G
- B3 = B
-
- If R3 > 1 Then Do
- A = R3 / 4
- A = Trunc(A)
- R3 = R3 - A
- End
- If G3 > 1 Then Do
- A = G3 / 4
- A = Trunc(A)
- G3 = G3 - A
- End
- If B3 > 1 Then Do
- A = B3 / 4
- A = Trunc(A)
- B3 = B3 - A
- End
-
- SetPen R3 G3 B3
- Line (X2 - 1) (Y1 + 2) (X2 - 1) (Y2 - 2)
- Line (X2 - 1) (Y2 - 1) (X1 + 2) (Y2 - 1)
-
- R4 = R3
- G4 = G3
- B4 = B3
-
- If R4 >1 Then Do
- A = R4 / 3
- A = Trunc(A)
- R4 = R4 - A
- End
- If G4 > 1 Then Do
- A = G4 / 3
- A = Trunc(A)
- G4 = G4 - A
- End
- If B4 > 1 Then Do
- A = B4 / 3
- A = Trunc(A)
- B4 = B4 - A
- End
-
- SetPen R4 G4 B4
- Line X2 (Y1 + 1) X2 Y2
- Line X2 Y2 (X1 + 1) Y2
- SetPen 0 0 0
- Line X2 Y2 X2 Y2
-
- /* Make Highlight Center Binder */
-
- Center = (X2 - X1)
- Center = Center / 2
- Center = Trunc(Center)
- A = Center / 10
- A = Trunc(A)
- Center = Center + X1
-
- A = A + Center
- A2 = A + 1
- SetPen R2 G2 B2
- Line A Y1 A (Y2 - 1)
- SetPen R1 G1 B1
- Line A2 (Y1 + 1) A2 (Y2 - 2)
- SetPen R G B
- Line A Y2 A2 (Y2 - 1)
- SetPen 255 255 255
- Line A Y1 A Y1
-
- /* Make Shadow Center Binder */
-
- Center = (X2 - X1)
- Center = Center / 2
- Center = Trunc(Center)
- C = Center / 10
- C = Trunc(C)
- Center = Center + X1
-
- C = Center - C
- C2 = C - 1
-
- SetPen R4 G4 B4
- Line C (Y1 + 1) C Y2
- SetPen R3 G3 B3
- Line C2 (Y1 + 2) C2 (Y2 - 1)
- SetPen R G B
- Line C Y1 C2 (Y1 + 1)
- SetPen 0 0 0
- Line C Y2 C Y2
-
- /* Draw Paper Area */
-
- If Width > Height Then Inset = (Y2 - Y1)
- Else Inset = (X2 - X1)
- Inset = Inset / 50
- Inset = Trunc(Inset)
- SetPen 160 160 160
- SolidRect (X1 + Inset) (Y1 + Inset) (X2 - Inset) (Y2 - Inset)
-
- /* Draw Paper sides */
-
- A = (X2 - Inset) - (X1 + Inset)
- A = A / 18
- A = Trunc(A)
-
- SetPen 190 190 190
- SolidRect (X1 + Inset) (Y1 + Inset) (X1 + Inset + A) (Y2 - Inset)
-
- SetPen 130 130 130
- SolidRect (X2 - Inset) (Y1 + Inset) ((X2 - Inset) - A) (Y2 - Inset)
-
- /* Draw Paper Center */
-
- FillMode GRADIENT
- GradType 1
- GradNum 1
- ColGradTag 0 160 160 160
- ColGradTag 1 100 100 100
- SolidRect (Center - (Inset * 3)) (Y1 + Inset) Center (Y2 - Inset)
- ClearColGrad
- ColGradTag 0 120 120 120
- ColGradTag 0.2 160 160 160
- ColGradTag 0.5 190 190 190
- ColGradTag 1 160 160 160
- SolidRect Center (Y2 - Inset) (Center + (Inset * 3)) (Y1 + Inset)
- Okay 'Operation complete.'
- RestoreSetUp
-
- EXIT